*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* OUTPUT: TABLE H1 (Online Appendix)

***************************

cd ""

use "DTA files/Dataset", clear

putexcel set "Tables/H1", modify 

global horizon 6 
global ci = 1.645

************ PREPARE DATASET **********

run "Do files/Clean dataset"

* Hourly wage
gen W = 100*log((lab/H_EMP)/PCPI)
* Employment
gen E = 100*log(H_EMP)
* Capital-output ratio 
gen K = 100*log(K_GFCF/va)

* Dependent variables
foreach v in W E K {
gen `v'1 = `v'-l.`v'
forvalues i = 2 / $horizon {
local sc = `i'-1
gen `v'`i' = f`sc'.`v'-l.`v'
}
}

* Lags dependent variable
foreach v in W E K {
forvalues l = 1 / 6 {
gen l`l'`v' = l`l'.`v'1
}
}

************ ANALYSIS **********

foreach s in 2 {
mat mat`s' = J(12,$horizon,.)

* Baseline
forvalues i= 1/$horizon {
quietly reghdfe  Y`i' r`s' l1Y l2Y l3Y l4Y l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[1,`i'] = results[1,1]
mat mat`s'[2,`i'] = results[2,1]
mat mat`s'[3,`i'] = results[4,1]
* Wage
quietly reghdfe  W`i' r`s' l1W l2W l3W l4W l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[4,`i'] = results[1,1]
mat mat`s'[5,`i'] = results[2,1]
mat mat`s'[6,`i'] = results[4,1]
* Employment
quietly reghdfe  E`i' r`s' l1E l2E l3E l4E l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[7,`i'] = results[1,1]
mat mat`s'[8,`i'] = results[2,1]
mat mat`s'[9,`i'] = results[4,1]
* Capital-output ratio
quietly reghdfe  K`i' r`s' l1K l2K l3K l4K l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[10,`i'] = results[1,1]
mat mat`s'[11,`i'] = results[2,1]
mat mat`s'[12,`i'] = results[4,1]
}
}

* Save output
putexcel B4=matrix(mat2)
